package org.ume.school.modules.model.entity;

import org.apache.commons.lang3.StringUtils;
import org.ume.school.modules.utils.TimeUtils;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by Django on 2017/7/19.
 * 广告表                                        bi
 */
@Entity
@Table(name = "vshop_adverts")
public class Adverts implements Serializable {


    @Column(name = "id", columnDefinition = "varchar(64) NOT NULL")
    @Id
    private String id;

    @Column(name = "title", columnDefinition = "varchar(1024) DEFAULT NULL")
    private String title;

    /**
     * 1 随笔  2 散文 3 诗词 4 小说
     */
    @Column(name = "type", columnDefinition = "varchar(64) DEFAULT NULL COMMENT '类型'")
    private String type;

    /**
     * 创作时间
     */
    @Column(name = "create_time", columnDefinition = "datetime DEFAULT NULL")
    private Date createTime;

    /**
     * 发布人
     */
    @Column(name = "user_id", columnDefinition = "varchar(255) DEFAULT NULL")
    private String userId;

    /**
     * 作者名称
     */
    @Column(name = "user_name", columnDefinition = "varchar(255) DEFAULT NULL")
    private String userName;

    /**
     * 摘要，序
     */
    @Column(name = "summary", columnDefinition = "varchar(2048) DEFAULT NULL")
    private String summary;
    /**
     * 广告内容
     */
    @Column(name = "content", columnDefinition = "text")
    private String content;

    //广告宣传封面图
    @Column(name = "image", columnDefinition = "varchar(255) DEFAULT NULL")
    private String image;

    /*点击弹出地址*/
    @Column(name = "link", columnDefinition = "varchar(255) DEFAULT NULL")
    private String link;

    /**
     * 放置位置： 1 ：  滚动区 300 * 300  2： 640*80  小横向区域  3: 1024*180 大横向区域 :4 长区域  c
     */
    @Column(name = "place", columnDefinition = "INT default 0")
    private Integer place = 0;

    @Transient
    private String sdate;

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getSdate() {
        if (null != this.getCreateTime()) {
            sdate = TimeUtils.parseNLPattern(this.getCreateTime());
        }
        return sdate;
    }

    public void setSdate(String sdate) {
        this.sdate = sdate;
    }

    public Adverts() {
    }

    public Adverts(String id, String content) {
        this.id = id;
        this.content = content;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }
}
